#include <stdio.h>

int main() {
    int triangle[10][10];
    for (int i = 0; i < 10; i++) {
        for (int j = 0; j <= i; j++) {
            if (j == 0 || j == i) {
                triangle[i][j] = 1;
            } else {
                triangle[i][j] = triangle[i-1][j-1] + triangle[i-1][j];
            }
        }
    }
    printf("杨辉三角的前10行:\n");
    for (int i = 0; i < 10; i++) {

        for (int j = 0; j <= i; j++) {
            printf("%6d", triangle[i][j]);
        }
        printf("\n");
    }
    
    return 0;
}
